<?php
/**
 * 用户反馈管理
 * 
 * @author  Lee<a605333742@gmail.com>
 * @time    2016-09-28
 */
namespace Admin\Controller;

class FeedbackController extends CommonController{
    /*
     * 构造函数
     * 
     * @return  #
     */
    public function _initialize() {
        parent::_initialize();
        $this->db   =D('Feedback');   
    }
    
    /*
     * 用户反馈列表
     * 
     * @return #
     */
    public function index(){
        if(I("request.content")){
            $map['content'] =I("request.content");
        }
        $map            =$this->_search("Feedback");
        if(I("request.userid")){
            $map['userid']  =A("Common")->getIds(I("request.userid"),"nickName","User");
        }
        
        $map['status']  =1;
        $list           =$this->_list($this->db,$map,'credate');
        $this->assign("list",$list);
        $this->display();
    }
    
    /*
     * 删除指定的用户反馈
     * 
     * @return #
     */
    public function del(){
        if(!I("request.id")){
            $this->error("参数错误");
        }
        if(is_array(I("request.id"))){
            $map['id']=array("in",implode(',',I("request.id")));            
        }else{
            $map['id']  =I("request.id");
        }
        $map['status']  =0;
        if($this->db->save($map)){
            $this->success("删除成功");
        }else{
            $this->error("删除失败");
        }
    }
}
